-
Notifications
You must be signed in to change notification settings - Fork 165
git-add: Skip submodules with ignore=all unless --force and explicit path used #1987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Welcome to GitGitGadgetHi @bicschneider, and welcome to GitGitGadget, the GitHub App to send patch series to the Git mailing list from GitHub Pull Requests. Please make sure that either:
You can CC potential reviewers by adding a footer to the PR description with the following syntax: NOTE: DO NOT copy/paste your CC list from a previous GGG PR's description, Also, it is a good idea to review the commit messages one last time, as the Git project expects them in a quite specific form:
It is in general a good idea to await the automated test ("Checks") in this Pull Request before contributing the patches, e.g. to avoid trivial issues such as unportable code. Contributing the patchesBefore you can contribute the patches, your GitHub username needs to be added to the list of permitted users. Any already-permitted user can do that, by adding a comment to your PR of the form Both the person who commented An alternative is the channel Once on the list of permitted usernames, you can contribute the patches to the Git mailing list by adding a PR comment If you want to see what email(s) would be sent for a After you submit, GitGitGadget will respond with another comment that contains the link to the cover letter mail in the Git mailing list archive. Please make sure to monitor the discussion in that thread and to address comments and suggestions (while the comments and suggestions will be mirrored into the PR by GitGitGadget, you will still want to reply via mail). If you do not want to subscribe to the Git mailing list just to be able to respond to a mail, you can download the mbox from the Git mailing list archive (click the curl -g --user "<EMailAddress>:<Password>" \
--url "imaps://imap.gmail.com/INBOX" -T /path/to/raw.txtTo iterate on your change, i.e. send a revised patch or patch series, you will first want to (force-)push to the same branch. You probably also want to modify your Pull Request description (or title). It is a good idea to summarize the revision by adding something like this to the cover letter (read: by editing the first comment on the PR, i.e. the PR description): To send a new iteration, just add another PR comment with the contents: Need help?New contributors who want advice are encouraged to join [email protected], where volunteers who regularly contribute to Git are willing to answer newbie questions, give advice, or otherwise provide mentoring to interested contributors. You must join in order to post or view messages, but anyone can join. You may also be able to find help in real time in the developer IRC channel, |
|
There are issues in commit a3105e7: |
|
There are issues in commit b2d5354: |
|
There are issues in commit 8348a4a: |
|
There are issues in commit 6657438: |
|
There are issues in commit c2d703e: |
|
There are issues in commit a56d8b8: |
|
There are issues in commit 79598c6: |
|
There are issues in commit 1b8d93b: |
|
There are issues in commit e45daed: |
|
/allow |
|
User bicschneider is now allowed to use GitGitGadget. WARNING: bicschneider has no public email address set on GitHub; GitGitGadget needs an email address to Cc: you on your contribution, so that you receive any feedback on the Git mailing list. Go to https://github.com/settings/profile to make your preferred email public to let GitGitGadget know which email address to use. |
|
@bicschneider the Git project is very particular about the form of the commit messages it accepts, and it is outright hostile towards contributors who send patches that introduce white-space problems even if those are fixed by later patches in the same patch series (they demand that the fixes are squashed into the appropriate patches, which I recommend you do before Further, they are adamant about the Finally, you can increase the chances for a pleasant review on the Git mailing list dramatically by imitating the rather verbose style of Git's own commit messages. There is some really useful guidance here, in particular the part where it recommends to ensure that the following are covered by the commit message:
|
e45daed to
d94d2d5
Compare
|
There are issues in commit fa7cf4e: |
|
There are issues in commit 78c6a1a: |
|
There are issues in commit d94d2d5: |
ee01742 to
cd3e2a3
Compare
|
@bicschneider you needn't worry about the |
80907de to
416695f
Compare
|
/allow |
|
User bicschneider already allowed to use GitGitGadget. |
|
/preview |
ee84190 to
0042274
Compare
|
There are issues in commit aca2c81: |
0042274 to
3694c59
Compare
|
There are issues in commit aca2c81: |
1824c57 to
ee9c8dd
Compare
961c463 to
cb854a8
Compare
The ignored_too parameter is added to the function add_files_to_cache for usage of explicit updating the index for the updated submodule using the explicit patchspec to the submodule. Signed-off-by: Claus Schneider(Eficode) <[email protected]>
Submodules configured with ignore=all are now skipped during add operations unless overridden by --force and the submodule path is explicitly specified. A message is printed (like ignored files) guiding the user to use the --force flag if the user has explicitely want to update the submodule reference. The reason for the change is support submodule branch tracking or similar and git status states nothing and git add should not add either as a default behaviour. The workflow is more logic and similar to regular ignored files even the submodule is already tracked. The change opens up a lot of possibilities for submodules to be used more freely and simular to the repo tool. A submodule can be added for many more reason and loosely coupled dependencies to the super repo which often gives the friction of handle the explicit commits and updates without the need for tracking the submodule sha1 by sha1. Signed-off-by: Claus Schneider(Eficode) <[email protected]>
The tests verify that the submodule behavior is intact and updating the config with ignore=all also behaves as intended with configuration in .gitmodules and configuration given on the command line. The usage of --force is showcased and tested in the test suite. The test file is added to meson.build for execution. Signed-off-by: Claus Schneider(Eficode) <[email protected]>
There are tests that rely on "git add <submodule>" to update the in the reference in the parent repository which have been updated to use the --force option. Updated tests: - t1013-read-tree-submodule.sh ( fixed in: t/lib-submodule-update.sh ) - t2013-checkout-submodule.sh ( fixed in: t/lib-submodule-update.sh ) - t7406-submodule-update.sh - t7508-status.sh Signed-off-by: Claus Schneider(Eficode) <[email protected]>
- git-add.adoc: Update the --force documentation for submodule behaviour to be added even the given configuration ignore=all. - gitmodules.adoc and config/submodule.adoc: The submodule config ignore=all now need --force in order to update the index. Signed-off-by: Claus Schneider(Eficode) <[email protected]>
cb854a8 to
37fe795
Compare
|
/submit |
|
Submitted as [email protected] To fetch this version into To fetch this version to local tag |
| command-line option to "git fetch" and "git pull". | ||
| This setting will override that from in the linkgit:gitmodules[5] | ||
| file. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ben Knoble wrote on the Git mailing list (how to reply to this email):
> Le 14 janv. 2026 à 02:48, Claus Schneider(Eficode) via GitGitGadget <[email protected]> a écrit :
>
> From: "Claus Schneider(Eficode)" <[email protected]>
>
> - git-add.adoc: Update the --force documentation for submodule behaviour
> to be added even the given configuration ignore=all.
> - gitmodules.adoc and config/submodule.adoc: The submodule config
> ignore=all now need --force in order to update the index.
>
> Signed-off-by: Claus Schneider(Eficode) <[email protected]>
> ---
> Documentation/config/submodule.adoc | 13 +++++++------
> Documentation/git-add.adoc | 5 ++++-
> Documentation/gitmodules.adoc | 5 ++++-
> 3 files changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/Documentation/config/submodule.adoc b/Documentation/config/submodule.adoc
> index 0672d99117..250a6133d8 100644
> --- a/Documentation/config/submodule.adoc
> +++ b/Documentation/config/submodule.adoc
> @@ -32,15 +32,16 @@ submodule.<name>.fetchRecurseSubmodules::
>
> submodule.<name>.ignore::
> Defines under what circumstances "git status" and the diff family show
> - a submodule as modified. When set to "all", it will never be considered
> - modified (but it will nonetheless show up in the output of status and
> - commit when it has been staged), "dirty" will ignore all changes
> - to the submodule's work tree and
> + a submodule as modified.
> + Set to "all" will never consider the
Throughout this patch, missing “When set to…” for idiomatic English.
> submodule modified. It can
> + nevertheless be staged using the option --force and it will then show up
> + in the output of status.
> + Set to "dirty" will ignore all changes to the submodule's work tree and
> takes only differences between the HEAD of the submodule and the commit
> recorded in the superproject into account. "untracked" will additionally
> let submodules with modified tracked files in their work tree show up.
> - Using "none" (the default when this option is not set) also shows
> - submodules that have untracked files in their work tree as changed.
> + Set to "none"(default) It is also shows submodules that have untracked
> + files in their work tree as changed.
> This setting overrides any setting made in .gitmodules for this submodule,
> both settings can be overridden on the command line by using the
> "--ignore-submodules" option. The 'git submodule' commands are not
> diff --git a/Documentation/git-add.adoc b/Documentation/git-add.adoc
> index 6192daeb03..941135dc63 100644
> --- a/Documentation/git-add.adoc
> +++ b/Documentation/git-add.adoc
> @@ -75,7 +75,10 @@ in linkgit:gitglossary[7].
>
> `-f`::
> `--force`::
> - Allow adding otherwise ignored files.
> + Allow adding otherwise ignored files. The option is also used when
> + `submodule.<name>.ignore=all` is set, but you want to stage an
> + update of the submodule. The `path` to the submodule must be explicitly
> + specified.
>
> `--sparse`::
> Allow updating index entries outside of the sparse-checkout cone.
> diff --git a/Documentation/gitmodules.adoc b/Documentation/gitmodules.adoc
> index d9bec8b187..3792da96aa 100644
> --- a/Documentation/gitmodules.adoc
> +++ b/Documentation/gitmodules.adoc
> @@ -70,7 +70,10 @@ submodule.<name>.ignore::
> --
> all;; The submodule will never be considered modified (but will
> nonetheless show up in the output of status and commit when it has
> - been staged).
> + been staged). Add `(new commits)` can be overruled using the
> + `git add --force <submodule.path>`.
> + The setting affects `status`, `update-index`, `diff` and `log`(due
> + to underlaying `diff`).
>
> dirty;; All changes to the submodule's work tree will be ignored, only
> committed differences between the `HEAD` of the submodule and its
> --
> gitgitgadget
> |
User |
| #include "thread-utils.h" | ||
| #include "progress.h" | ||
| #include "sparse-index.h" | ||
| #include "csum-file.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Kristoffer Haugsbakk" wrote on the Git mailing list (how to reply to this email):
On Wed, Jan 14, 2026, at 08:47, Claus Schneider(Eficode) via GitGitGadget wrote:
> From: "Claus Schneider(Eficode)" <[email protected]>
>
> Submodules configured with ignore=all are now skipped during add operations
> unless overridden by --force and the submodule path is explicitly specified.
>
> A message is printed (like ignored files) guiding the user to use the
> --force flag if the user has explicitely want to update the submodule
> reference.
>
> The reason for the change is support submodule branch tracking or
> similar and git status states nothing and git add should not add either
> as a default behaviour. The workflow is more logic and similar to regular
> ignored files even the submodule is already tracked.
>
> The change opens up a lot of possibilities for submodules to be used
> more freely and simular to the repo tool. A submodule can be added for many
s/simular/similar/ ? Although the sentence doesn’t quite make sense to
me. Well I’m unfamiliar with the domain anyway. ;)
> more reason and loosely coupled dependencies to the super repo which often
s/more reason/more reasons/ ?
> gives the friction of handle the explicit commits and updates without
s/handle/handling/
> the need for tracking the submodule sha1 by sha1.
>
> Signed-off-by: Claus Schneider(Eficode) <[email protected]>
> ---
>[snip]|
User |
|
This branch is now known as |
|
This patch series was integrated into seen via git@c15ea74. |
|
There was a status update in the "New Topics" section about the branch "git add <submodule>" has been taught to honor submodule.<name>.ignore that is set to "all" (and requires "git add -f" to override it). Expecting a reroll? cf. <[email protected]> source: <37fe7956e089394bb1d75f4c8af4a3347b204803.1768376879.git.gitgitgadget@gmail.com> |
The
ignore=allconfiguration for submodules is currently honored bystatusanddiff, but not byadd. This inconsistency causes frictionwhen working with submodules:
and unnecessary changes.
to the submodule SHA1 are added without intent.
This patch aligns
git addwith the behavior ofstatusanddiff:ignore=allare skipped by default.--force.A submodule can frictionless track a branch in the configuration or
manually switched to and use update
--update --remotewithoutunintentionally add the changes to the super-project.
Tests that previously added submodules without
--forcehave been updatedaccordingly. A new test is added to test the behavior of
git addwith andwithout
--force.CC: Ævar Arnfjörð Bjarmason [email protected]
CC: Junio C Hamano [email protected]
CC: Brandon Williams [email protected]
cc: Phillip Wood [email protected]
cc: Claus Schneider [email protected]
cc: Ben Knoble [email protected]
cc: "Kristoffer Haugsbakk" [email protected]